package org.nepu.scr.indexrate.converter.drillingrate.jobarticulation;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.jobarticulation.JobInput;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class JobInputConverter implements AttributeConverter<JobInput, String> {
    @Override
    public String convertToDatabaseColumn(JobInput keyJobInput) {
        return JSONUtil.toJsonStr(keyJobInput);
    }

    @Override
    public JobInput convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, JobInput.class);
    }
}
